.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.app-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 0 0 20px 20px;
  margin: 10px 10px 20px 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.header-text {
  flex: 1;
  text-align: left;
}

.header-text h1 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 28px;
  font-weight: bold;
}

.header-text p {
  margin: 0;
  color: #666;
  font-size: 16px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.ai-settings-btn,
.translate-all-btn,
.storage-manager-btn,
.restore-cache-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-settings-btn {
  background: #6c757d;
  color: white;
}

.ai-settings-btn:hover {
  background: #545b62;
  transform: translateY(-1px);
}

.translate-all-btn {
  background: #28a745;
  color: white;
}

.translate-all-btn:hover:not(:disabled) {
  background: #218838;
  transform: translateY(-1px);
}

.translate-all-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.storage-manager-btn {
  background: #17a2b8;
  color: white;
}

.storage-manager-btn:hover {
  background: #138496;
  transform: translateY(-1px);
}

.restore-cache-btn {
  background: #fd7e14;
  color: white;
}

.restore-cache-btn:hover:not(:disabled) {
  background: #e8650e;
  transform: translateY(-1px);
}

.restore-cache-btn:disabled {
  background: #ffc107;
  color: #666;
  cursor: not-allowed;
  transform: none;
}

.app-main {
  flex: 1;
  padding: 0 10px 120px 10px; /* 增加底部padding为底部控制面板留空间 */
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.app-footer {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 15px;
  text-align: center;
  margin: 20px 10px 10px 10px;
  border-radius: 20px 20px 0 0;
}

.app-footer p {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  }

  .app-header {
    margin: 5px 5px 15px 5px;
    padding: 15px;
    border-radius: 0 0 15px 15px;
  }

  .header-content {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .header-text {
    text-align: center;
  }

  .header-text h1 {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .header-text p {
    font-size: 14px;
  }

  .header-actions {
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .ai-settings-btn,
  .translate-all-btn,
  .storage-manager-btn,
  .restore-cache-btn {
    padding: 8px 12px;
    font-size: 13px;
    flex: 1;
    min-width: 85px;
    max-width: 100px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    border-radius: 18px;
  }

  .app-main {
    padding: 0 5px 120px 5px; /* 移动端也需要底部空间 */
  }

  .app-footer {
    margin: 15px 5px 5px 5px;
    padding: 12px;
    border-radius: 15px 15px 0 0;
  }

  .app-footer p {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .app-header {
    margin: 3px 3px 12px 3px;
    padding: 12px;
    border-radius: 0 0 12px 12px;
  }

  .header-text h1 {
    font-size: 20px;
    margin-bottom: 6px;
  }

  .header-text p {
    font-size: 13px;
  }

  .ai-settings-btn,
  .translate-all-btn,
  .storage-manager-btn,
  .restore-cache-btn {
    padding: 6px 8px;
    font-size: 11px;
    min-width: 65px;
    max-width: 75px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    border-radius: 16px;
    white-space: nowrap;
    overflow: hidden;
  }

  /* 简化按钮文字 */
  .ai-settings-btn {
    font-size: 0;
  }
  .ai-settings-btn::after {
    content: "⚙️ AI";
    font-size: 11px;
  }

  .storage-manager-btn {
    font-size: 0;
  }
  .storage-manager-btn::after {
    content: "📦 缓存";
    font-size: 11px;
  }

  .translate-all-btn {
    font-size: 11px;
    min-width: 70px;
  }
  
  /* 翻译按钮需要保持原有文字以显示状态 */

  .restore-cache-btn {
    font-size: 0;
  }
  .restore-cache-btn::after {
    content: "🔄 恢复";
    font-size: 11px;
  }

  .app-main {
    padding: 0 3px 120px 3px; /* 小屏幕也需要底部空间 */
  }

  .app-footer {
    margin: 12px 3px 3px 3px;
    padding: 10px;
    border-radius: 12px 12px 0 0;
  }

  .app-footer p {
    font-size: 12px;
  }
}

/* 针对移动端的优化 */
@media (max-width: 768px) and (orientation: portrait) {
  .app-main {
    max-width: 100vw;
    overflow-x: hidden;
  }
}

/* 针对横屏移动设备的优化 */
@media (max-width: 768px) and (orientation: landscape) {
  .app-header {
    padding: 10px;
  }
  
  .app-header h1 {
    font-size: 22px;
  }
  
  .app-main {
    padding: 0 5px 120px 5px; /* 横屏模式也需要底部空间 */
  }
}

/* 针对小屏幕设备的触摸优化 */
@media (pointer: coarse) {
  .app {
    -webkit-overflow-scrolling: touch;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .app-header {
    background: rgba(40, 44, 52, 0.95);
  }
  
  .app-header h1 {
    color: #e6e6e6;
  }
  
  .app-header p {
    color: #b8b8b8;
  }
  
  .app-footer p {
    color: rgba(255, 255, 255, 0.7);
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  .app-header {
    background: white;
    border: 2px solid #333;
  }
  
  .app-header h1 {
    color: #000;
  }
  
  .app-header p {
    color: #333;
  }
}